Should I use `import os.path` or `import os`?
Posted
by Denilson Sá
on Stack Overflow
See other posts from Stack Overflow
or by Denilson Sá
Published on 2010-04-27T19:26:26Z
Indexed on
2010/04/27
20:03 UTC
Read the original article
Hit count: 94
python
According to the official documentation, os.path
is a module. Thus, what is the preferred way of importing it?
# Should I always import it explicitly?
import os.path
Or...
# Is importing os enough?
import os
Please DON'T answer "importing os
works for me". I know, it works for me too right now. What I want to know is any official recommendation about this issue. So, if you answer this question, please post your references.
© Stack Overflow or respective owner